#!/usr/bin/python

# 一个类的基本例子
class Employee:
    __secretCount = 0  # 私有变量
    count = 0
    def __init__(self,name,salary):
        self.name = name
        self.salary = salary
        Employee.count += 1

    def __del__(self): #del 对象会触发这个方法
        class_name = self.__class__.__name__
        # print(class_name + '销毁')
    
    def displayCount(self):
        print("Total Employee %d" %(Employee.count))
    
    def displaySalary(self):
        print("salary is %d" %(self.salary))

emp1 = Employee('lxt',100)
emp1.displayCount()
emp1.displaySalary()

emp2 = Employee('xiaotao',200)
emp2.displayCount()
emp2.displaySalary()
print(Employee.count)


print("--------获取类的属性--------")
print(getattr(emp1,'name'))
print(hasattr(emp1,'name'))

print("--------获取类的内置属性--------")
print("Employee.__name__:", Employee.__name__)
print("Employee.__module__:", Employee.__module__)

print("--------类继承--------")
class Parent1:
    def parentInit(self):
        print("parent1Init")

class Parent2:
    def parent2Init(self):
        print("parent2Init")


class Child(Parent1,Parent2): # 多继承
    def childInit(self):
        print("child Init")

    def parent2Init(self):
        print("parent2Init chong xie")

child1 = Child()
child1.parentInit()
child1.parent2Init()
child1.parent2Init()

